-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(RecoverWith): add recoverWith Operator #260
base: master
Are you sure you want to change the base?
Conversation
next(401, -1), | ||
next(402, -1), | ||
complete(405) | ||
]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you write a marble test instead.
src/operators/RecoverWith.ts
Outdated
|
||
next(val: T): void { | ||
this.sink.next(val) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can use a mixen for this
src/operators/RecoverWith.ts
Outdated
|
||
export type TSource<T> = IObservable<T> | ||
export type TResult<R> = IObservable<R> | ||
export type TMapper<T> = (err: Error) => T |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
T should be an observable here. Once the values are recovered there is no way to detect if the returned observable carries a value or an error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tusharmath you mean source should be observable of observable?
describe('recoverWith()', () => { | ||
it('should only emit errors as data', () => { | ||
const sh = createTestScheduler() | ||
const $ = sh.Cold<number>([ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will need tests for when the subscription starts and when it ends.
EVENT.next(403, 'b'), | ||
EVENT.next(407, 'c'), | ||
EVENT.next(411, 'd'), | ||
EVENT.next(604, 'z'), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As soon as an error is dispatched. The subscription should end. So even though the stream is firing c-#-d
it should not be captured by the observer. This is a fundamental architectural assumption that is being made for all other operators.
No description provided.